package com.wcl.nullmusic.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

/**
 * Created by dllo on 16/1/8.
 */
public class ToActivityUtils {
    private static ToActivityUtils toActivityUtils;

    private ToActivityUtils() {
    }

    public static ToActivityUtils getInstance() {
        if (toActivityUtils == null)
            toActivityUtils = new ToActivityUtils();
        return toActivityUtils;
    }

    public static void startToActivity(Context from, Class to) {
        Intent intent = new Intent(from, to);
        from.startActivity(intent);
    }

    public static void startToActivity(Context from, Class to, Bundle bundle) {
        Intent intent = new Intent(from, to);
        intent.putExtras(bundle);
        from.startActivity(intent);
    }

    public static Bundle fromSrc(Context context) {
        Intent intent = ((Activity) context).getIntent();
        return intent.getExtras();
    }
}
